/**
===============================
============框架初始化js==========
===============================
*/
//全局项目请求地址
var $location = (window.location+'').split('/');
var $basePath = $location[0]+'//'+$location[2]+'/'+$location[3];
//全局内容区域
var $initContainer = $("#initContainer");
//全局提示框
function bootAlert(data,type){
	BootstrapDialog.alert({
		title: '提示',
        message: data,
        type: type==undefined?BootstrapDialog.TYPE_WARNING:type, // <-- Default value is BootstrapDialog.TYPE_PRIMARY
        closable: true, // <-- Default value is false
        draggable: true, // <-- Default value is false
        buttonLabel: '确认' // <-- Default value is 'OK',
	});
}

$(function() {
	//注册
	$("#nav_regist").click(function() {
		BootstrapDialog.alert('I want apple!');
	});
	//登录
	$("#nav_login").click(function() {
		BootstrapDialog.alert('I want login!');
	});
	//注销
	$("#nav_logout").click(function() {
		BootstrapDialog.alert('I want logout!');
	});
	
	//绑定所有的菜单链接点击事件，根据不同的URL加载页面
	$("#menu li a[url]").click(function(){
		//加载页面
		$initContainer.load($basePath+$(this).attr("url"));
	});
	
	//默认加载的页面
	$initContainer.load($basePath+$("#menu li a[url][class='initURL']").attr("url"));
	console.log($basePath);
});
